﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SW.TimerTask.ServiceTest
{
    /// <summary>
    /// GetAPI 的摘要说明
    /// </summary>
    public class GetAPI : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            try
            {
                var name = context.Request.QueryString["name"].ToString();
                context.Response.Write(ResponseMsg(0, "Hello ," + name));
            }
            catch (Exception e)
            {
                context.Response.Write(ResponseMsg(-1, e.Message));
            }
            
        }

        private string ResponseMsg(int code, string msg)
        {
            return code + "|" + msg;
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}